package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.NursingPlan;
import com.zzyl.entity.NursingProjectPlan;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 护理计划Mapper接口
 */
@Mapper
public interface NursingPlanMapper {

    Page<NursingPlan> selectByPage(String planName, Integer status);

    // 插入主表（返回影响行数）
    int insert(NursingPlan plan);

    // 批量插入关联表
    int batchInsertProjectPlans(@Param("list") List<NursingProjectPlan> list);

    List<NursingPlan> selectList();

    NursingPlan selectById(Long id);

    int update(NursingPlan nursingPlan);

    int batchUpdateProjectPlans(@Param("list") List<NursingProjectPlan> projectPlans);

    List<NursingProjectPlan> selectProjectPlansByPlanId(@Param("planId") Long planId);

    // 根据ID删除主表
    int deleteById(@Param("id") Long id);

    // 根据计划ID删除关联项目
    int deleteProjectPlansByPlanId(@Param("planId") Long planId);

    void updateStatusById(Long id, Integer status);

    String getPlanNameByPlanId(@Param("id") Long id);
}